package com.lw.question01;

import java.util.Scanner;

/**
 * @author LW
 * @2020/9/14 8:37
 */
public class 输入计日 {

    public static void main(String[] args) {
        int[] mm = {31,28,31,30,31,30,31,31,30,31,30,31};//12月份
        int sum = 0;//计算此年的天数
        Scanner input = new Scanner(System.in);
        System.out.println("输入某年某月某日");
        System.out.print("年：");
        int year = input.nextInt();
        System.out.print("月：");
        int m = input.nextInt();
        System.out.print("日：");
        int d = input.nextInt();
        if ((year % 4==0 && year % 100!=0) || year % 400== 0){
            for (int i = m-1; i > 0; i--) {
                sum = sum + mm[i-1];
            }
            if (m>2){
                sum += 1;
            }
        }else {
            for (int i = m-1; i > 0; i--) {
                sum = sum + mm[i-1];
            }
        }
        sum += d;

        System.out.println(year+"年"+m+"月"+d+"日"+"是这一年的第"+sum+"天");

    }
}
